import shutil

file = open("C:/Work/ocx10.29/yolov5-master/datasets/vehicledet-11class/valid0.txt")

while 1:
    line = file.readline().strip()
    if not line:
        break
    else:
        oldname = u"C:\\Work\\ocx10.29\\yolov5-master\\datasets\\vehicledet-11class\\labels\\" + line
        newname = u"C:\\Work\\ocx10.29\\yolov5-master\\datasets\\vehicledet-11class\\labels\\val\\" + line
        try:
            shutil.copyfile(oldname, newname)
        except IOError:
            print("no such file:" + line)
        else:
            print(line)

